Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(component): add autoComplete prop for selects #542

Merged
merged 1 commit into from
May 18, 2021

Conversation

jorgemoya
Copy link
Contributor

What

Allow custom values for autoComplete. Defaults to off.

Why

Fixes #540

@jorgemoya jorgemoya requested a review from a team as a code owner May 17, 2021 20:04
Copy link
Contributor

@chanceaclark chanceaclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, but could you actually show how it fixes #540?

@@ -7,6 +7,7 @@ import { SelectOptionGroup } from '../Select/types';

interface BaseSelect extends Omit<React.HTMLAttributes<HTMLInputElement>, 'children'> {
action?: SelectAction;
autoComplete?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check that this is not on React.HTMLAttributes<HTMLInputElement>?

Copy link
Contributor Author

@jorgemoya jorgemoya May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't, I would need to use AllHTMLAttributes

Copy link
Contributor

@chanceaclark chanceaclark May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah makes sense. We'd probably want to do this for the Form component too then. (it's only on | off for the form element).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it defaults to on on the form?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FormHTMLAttributes does have autoComplete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I could swap the type of the Selects for <React.InputHTMLAttributes<HTMLInputElement> which do include autoComplete and a bunch of others

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Only thing we need to make sure if we do, is that the types we say we allow (for example, valid input attributes like any aria- ones, or the multiple attribute) are actually passed in to the underlying component. We don't want our types to say we have something that our component doesn't actually implement.

Full list of input attributes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets keep as is since I don't want to expose all those to the user.

@jorgemoya jorgemoya force-pushed the select-autocomplete branch from 8c3e26a to 6447c66 Compare May 18, 2021 14:51
@jorgemoya jorgemoya force-pushed the select-autocomplete branch from 6447c66 to 857bcbf Compare May 18, 2021 16:46
@jorgemoya jorgemoya merged commit 5ac23fd into bigcommerce:master May 18, 2021
@jorgemoya jorgemoya deleted the select-autocomplete branch May 18, 2021 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Select autocomplete not disabled in Chrome
4 participants